package vip.meeet.gc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ThreadTestWaitOn extends Thread {
    Object lockobj1 = new Object();

    public ThreadTestWaitOn() {
        this.setName(this.getClass().getName());
    }

    public void run() {
        fun();
    }

    public void fun() {
        synchronized (lockobj1) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            try {
                reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            fun_wait();
        }
    }

    public void fun_wait() {
        try {
            lockobj1.wait();
//            lockobj1.wait(100000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
